<?php

namespace app\common\model\xiluedu;

use think\Model;


class Vip extends Model
{


    // 表名
    protected $name = 'xiluedu_vip';


    // 追加属性
    protected $append = [
        'unit_text'
    ];

    public function getUnitList()
    {
        return ['1' => __('天'), '2' => __('月'), '3' => __('年')];
    }

    public function getUnitTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['unit']) ? $data['unit'] : '');
        $list = $this->getUnitList();
        return isset($list[$value]) ? $list[$value] : '';
    }

    public static function lists(){
        return static::field('weigh,createtime,updatetime',true)->where('status','1')->order('weigh','desc')->select();
    }


}
